<%@page import="com.jredu.entity.User"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/res/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/res/css/skin_/table.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/web/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/web/themes/icon.css">
<script type="text/javascript" src="<%=request.getContextPath()%>/web/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/web/jquery.easyui.min.js"></script>

<title>表格</title>
</head>

<body>
<div id="container">
	<div id="hd"></div>
    <div id="bd">
    	<div id="main">
        	<div class="search-box ue-clear">
            	<div class="search-area">
                   
                    <div class="kv-item ue-clear">
                        <label>角色名称:</label>
                        <div class="kv-item-content">
                            <input type="text" name="roleName" id="roleName"/>
                        </div>
                    </div>
                </div>
                <div class="search-button" style="margin-left:20px">
                	<input class="button" type="button" value="搜索" />
                </div>
             </div>
             
            <div class="table">
            	
             	<div id="grid"></div>
             	<div class="pagination"></div>
            </div>
        </div>
    </div>
</div>
</body>

<script type="text/javascript">
	$('select').select();
	$('#grid').datagrid({
		url:'<%=request.getContextPath()%>/manager/user/user.do?reqCode=findUsers',
		columns:[[
			{field:'id',title:'编号',width:50,
				 styler:function(v,r,i){
				 	return "color:red";
				 }
			},
			{field:'account',title:'账号',width:100},
			{field:'name',title:'姓名',width:100},
			{field:'deptName',title:'部门',width:100},
			{field:'roleName',title:'角色',width:100},
			{field:'phone',title:'手机',width:100},
			{field:'qq',title:'QQ',width:100},
			{field:'_op',title:'操作',width:100,
				formatter:function(v,r,i){
					var s = "<a href='javascript:;' onclick=";
					s+="'remove(";
					s+=r.id;
					s+=")'";
					s+=">删除</a>";
					return s;
				}
			}
		]],
		singleSelect:true,
    	pagination:true,
    	loadMsg:'正在加载，请稍后……'
	});
	
	function remove(id){
		alert(id);
		//发起Ajax请求进行删除操作
		$.ajax({
			url:'<%=request.getContextPath()%>/manager/role/role.do',
			type:'post',
			data:{id:id,reqCode:'delRole'},
			success:function(data){
				$('#grid').datagrid('reload');
			},
			error:function(){
				
			}
		});
	}
	
	$('.search-box input[type=radio]').click(function(e) {
        if($(this).prop('checked')){
			if($(this).attr('data-define') === 'define'){
				$('.define-input').show();
			}else{
				$('.define-input').hide();
			}
		}
    });
    //根据条件查询角色
    $('input[type=button]').click(function(){
    	var v = $('#roleName').val();
    	$('#grid').datagrid('load',{
    		rolename:v
    	});
    });
    
</script>
</html>
